package 力扣日常刷题.木23一月.第08天308;

import java.util.Arrays;

/**
 * @author 帅小伙
 * @date 2022/3/8
 * @description
 */
public class Demo17数组中缺失的值 {


    public int missingNumber(int[] nums) {
        int l = 0, r = nums.length - 1;
        while(l <= r) {
            int m = (l + r) / 2;
            if (nums[m] == m) l = m + 1;
            else r = m - 1;
        }
        return l;
    }
}
